﻿using System;
using DuckFlyWithInterface;

namespace DuckFlyWithInterfaceTest
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("=== 鸭子模拟程序 ===");

            Duck duck1 = new Shelduck();
            Duck duck2 = new RedheadDuck();
            Duck duck3 = new RobberDuck();
            Duck duck4 = new RubberDuck();

            // 测试各种鸭子的行为
            TestDuck(duck1);
            TestDuck(duck2);
            TestDuck(duck3);
            TestDuck(duck4);

            Console.WriteLine("\n=== 动态改变行为 ===");

            // 动态改变强盗鸭的行为
            duck3.changeFlyBehavior(new FlyWithRocket());
            duck3.changeQuackBehavior(new NormalQuack());
            duck3.changeSwimBehavior(new NormalSwim());

            Console.WriteLine("强盗鸭获得了新能力！");
            TestDuck(duck3);
        }

        static void TestDuck(Duck duck)
        {
            duck.Display();
            duck.performFly();
            duck.performQuack();
            duck.performSwim();
            Console.WriteLine();
        }
    }
}